package com.github.wujichen158.andemusic;

import com.github.wujichen158.andemusic.lib.Reference;
import com.github.wujichen158.andemusic.newcommands.GetMusicCommand;
import com.github.wujichen158.andemusic.newcommands.SetAllMusicCommand;
import com.github.wujichen158.andemusic.newcommands.SetMusicCommand;
import com.github.wujichen158.andemusic.proxy.CommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import org.apache.logging.log4j.Logger;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION)
public class AndeMusic {
    public static Logger LOGGER;

    @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY)
    public static CommonProxy proxy;

    @Mod.Instance
    public static AndeMusic instance = new AndeMusic();

    @Mod.EventHandler
    public void preinit(FMLPreInitializationEvent event) {
        LOGGER = event.getModLog();
        proxy.preinit(event);
    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
        proxy.init(event);
    }

    @Mod.EventHandler
    public void postinit(FMLPostInitializationEvent event) {
        proxy.postinit(event);
    }

    @Mod.EventHandler
    public void serverStarting(FMLServerStartingEvent event) {
        event.registerServerCommand(new SetMusicCommand());
        event.registerServerCommand(new SetAllMusicCommand());
        event.registerServerCommand(new GetMusicCommand());
    }

}
